package com.itbaizhan;

import java.util.Random;

/**测试枚举，结合switch 语句*/
/*enum 枚举名{枚举体（常量列表）}
* 当你需要定义一组常量时，可以使用枚举类型
* 尽量不要使用枚举的高级特性，事实上高级特性都可以使用普通类来实现*/
public class TestEnum {

    public static void main(String[] args) {
       // System.out.println(Jijie.AUTUMN);
       // System.out.println(Season.WINTER);
        for(Season s:Season.values()){
            System.out.println(s);
        }
        int a = new Random().nextInt(4);//[0，1，2，3]
        switch (Season.values()[a]){
            case SPRING:
                System.out.println("春天");
                break;
            case SUMMER:
                System.out.println("夏季");
                break;
            case AUTUMN:
                System.out.println("秋天");
                break;
            case WINTER:
                System.out.println("冬天");
                break;
        }
    }
}
//枚举
enum Season {
    SPRING,SUMMER,AUTUMN,WINTER
}
class Jijie {
    public static final int SPRING = 0;
    public static final int SUMMER = 1;
    public static final int AUTUMN = 2;
    public static final int WINTER = 3;//后面的数字可以任意定义,与数字无关
}